package com.github.willisaway.core.util;

import java.util.Comparator;
import java.util.Date;

public class ComparatorDate implements Comparator<Date> {
    boolean isAsc;

    public ComparatorDate(boolean isAsc) {
        this.isAsc = isAsc;
    }

    public int compare(Date key1, Date key2) {
        int iResult = 0;
        if (isAsc) {
            iResult = key1.compareTo(key2);
        } else {
            iResult = key2.compareTo(key1);
        }
        return iResult;
    }
}
